package com.acme.bankapp.service.bank;

import com.acme.bankapp.domain.bank.Account;

public abstract class AbstractAccount implements Account {
    private double balance;

    public AbstractAccount(double balance) {
        if (balance < 0) {
            throw new IllegalArgumentException("Balance cannot be less than 0.");
        }
        this.balance = balance;
    }

    public double getBalance() {
        return balance;
    }

    protected void setBalance(double balance) {
        this.balance = balance;
    }

    public void deposit(double x) {
        balance += x;
    }
}